package com.class5.springboot.controller;

import com.alibaba.fastjson.JSONObject;
import com.class5.springboot.frame.repo.dto.PageData;
import com.class5.springboot.frame.repo.dto.ParamMap;
import com.class5.springboot.frame.web.SuperRestController;
import com.class5.springboot.frame.web.result.ResultData;
import com.class5.springboot.service.facade.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class UserController extends SuperRestController {

    @Autowired
    private IUserService userService;

    @PostMapping("/api/user/findUserForPage")
    public ResultData findUserForPage(HttpServletRequest req) {
        JSONObject param = new JSONObject();
        String date_s = req.getParameter("date_s");
        String date_e = req.getParameter("date_e");
        String userName = req.getParameter("userName");
        param.put("date_s",date_s);
        param.put("date_e",date_e);
        param.put("userName",userName);
        PageData pageData = userService.findUserForPage(ParamMap.get(param));
        return successWraper(pageData);
    }

}
